﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Collections.ObjectModel;
using System.Windows.Media.Imaging;

namespace Freshome.m.mds
{
    // Pairaw type
    public abstract class Pairaw : Shortype<Rmt.Pairaw>
    {
        public Pairaw(Rmt.Pairaw pm)
            : base(pm)
        {
            this._pm = pm;
        }
        public string Mate
        {
            get { return this._pm.Mate; }
            set
            {
                value = value.Trim();
                if (value.Match(@"^[\S\s]{2,10}$") && this._pm.Mate != value)
                {
                    this._pm.Mate = value;
                    this.Updated = !Created;
                }
                OnPropertyChanged("Mate");
            }
        }
        public override void Refresh(Rmt.Pairaw pm)
        {
            this.Mate = pm.Mate;
            this.Notes = pm.Notes;
            _pm.Jmx = pm.Jmx;
            this.Updated = false;
        }
        public bool IsValid
        {
            get
            {
                return _pm.Mate.Match(@"^[\S\s]{2,10}$") && _pm.Notes.Match(@"^[\S\s]{0,50}$");
            }
        }
    }
    public sealed class RightPair : Pairaw
    {
        public RightPair()
            : this(new Rmt.Pairaw { Mid = default(int), Taboo = false })
        {
            _pm.Mate = string.Empty;
            _pm.Notes = string.Empty;
        }
        public RightPair(Rmt.Pairaw pm)
            : base(pm)
        { }
    }
    public sealed class WrongPair : Pairaw
    {
        public WrongPair()
            : this(new Rmt.Pairaw { Mid = default(int), Taboo = true })
        {
            _pm.Mate = string.Empty;
            _pm.Notes = string.Empty;
        }
        public WrongPair(Rmt.Pairaw pm)
            : base(pm)
        { }
    }
}
